Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use analogPinToChannel if it's defined #1368

Merged
merged 4 commits into from
Aug 1, 2013
Merged

Use analogPinToChannel if it's defined #1368

merged 4 commits into from
Aug 1, 2013

Conversation

Lauszus
Copy link
Contributor

@Lauszus Lauszus commented Apr 17, 2013

See #1366

@damellis
Copy link
Contributor

This looks like it will break analogRead() on the ATmega32U4 (e.g. the Leonardo) because analogPinToChannel() will be called twice. Can you update (or verify that it's not a problem)?

@Lauszus
Copy link
Contributor Author

Lauszus commented Apr 17, 2013

Sorry my bad. It should be fixed now.

@damellis
Copy link
Contributor

Thanks! I don't see any immediate problems. What have you tested it with?

@Lauszus
Copy link
Contributor Author

Lauszus commented Apr 19, 2013

I havn't had time to test it on any yet. I will try to do it tomorrow or it will be on monday, as I'm off for the weekend.

Btw I left these lines untouched: https://github.com/Lauszus/Arduino/blob/59c5b94c51d726ea656471bc232333ebd200eb19/hardware/arduino/cores/arduino/wiring_analog.c#L51-L52, as I didn't want to break any compatibility issues with other devices out there. I don't know if it's really necessary, but I just thought it would be better to stay on the safe side.

@Lauszus
Copy link
Contributor Author

Lauszus commented Apr 19, 2013

I can confirm it's working on Arduino Mega, Mega2560, Leonardo and Uno.
This is the code I used to test it with:

void setup() {
  Serial.begin(115200);
}

void loop() {
  for(uint8_t i = 0; i < NUM_ANALOG_INPUTS; i++) {
    Serial.print(analogRead(A0+i));
    Serial.print('\t');
    delay(100);
  }
  Serial.println();
}

@Lauszus
Copy link
Contributor Author

Lauszus commented Apr 26, 2013

@damellis Have you had time to try it yet?

@Lauszus
Copy link
Contributor Author

Lauszus commented May 9, 2013

@damellis Any news regarding this issue?

@cmaglie cmaglie merged commit dbd584e into arduino:master Aug 1, 2013
@cmaglie
Copy link
Member

cmaglie commented Aug 1, 2013

Merged, thank you!
C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants